package com.mzy.utils;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class MaxHighRiskPeople {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        // Read input
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            y[i] = sc.nextInt();
        }
        
        sc.close();
        
        // Compute the maximum number of high-risk people
        int maxHighRiskCount = getMaxHighRiskPeople(n, k, x, y);
        
        // Print the result
        System.out.println(maxHighRiskCount);
    }
    
    private static int getMaxHighRiskPeople(int n, int k, int[] x, int[] y) {
        int maxCount = 0;
        
        for (int i = 0; i < n; i++) {
            Set<Integer> highRiskSet = new HashSet<>();
            
            for (int j = 0; j < n; j++) {
                if (calculateDistance(x[i], y[i], x[j], y[j]) <= k) {
                    highRiskSet.add(j);
                }
            }
            
            maxCount = Math.max(maxCount, highRiskSet.size());
        }
        
        return maxCount;
    }
    
    private static double calculateDistance(int x1, int y1, int x2, int y2) {
        return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
    }
}
